package controllers

import (
	"centerServer/models"
	"encoding/json"
	"github.com/astaxie/beego"
)

type QueryUserShare struct {
	beego.Controller
}

func (this *QueryUserShare)Get()  {
	requestInfo := models.QueryUserShareRequest{}
	backMsg := models.CreatorBackQueryUserShare(0, "")
	if err := this.ParseForm(&requestInfo); err != nil {
		//handle error
		backMsg.ReturnCode = -1
		backMsg.Msg = "参数解析错误" + err.Error()
		backData, _ := json.Marshal(backMsg)
		this.Ctx.Output.Body(backData)
		return
	}
	qData := models.UserShareInfo{UnionId: requestInfo.UnionId}
	backMsg.InviteCode = qData.FindInviteCode()
	backData, _ := json.Marshal(backMsg)
	this.Ctx.Output.Body(backData)
}
